package org.huntaway.kernel.mode.visitor.imp;

import java.util.Collection;
import java.util.Iterator;

import org.huntaway.kernel.mode.visitor.mode.Visitable;
import org.huntaway.kernel.mode.visitor.mode.Visitor;

public class ConcreteVisitor implements Visitor {

	@Override
	public void visitString(StringElement stringE) {
		System.out.println("'" + stringE.getValue() + "'");
	}

	@Override
	public void visitFloat(FloatElement floatE) {
		System.out.println("'" + floatE.getValue().toString() + "'");
	}

	@Override
	public void visitCollection(Collection collection) {
		Iterator iterator = collection.iterator();
		while (iterator.hasNext()) {
			Object obj = iterator.next();
			if (obj instanceof Visitable) {
				((Visitable) obj).accept(this);
			}
		}
	}
}
